<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="static/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="static/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="static/admin/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="static/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />

<title>添加</title>
</head>
<body>
<div class="pd-20">
  <form action="con/save.do" method="post" enctype="multipart/form-data" class="form form-horizontal" id="" onsubmit="return validate();">
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>头衔：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="title" name="TITLE" datatype="*2-16" nullmsg="标题不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>姓名：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="username" name="NAME" datatype="*2-5" nullmsg="姓名不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
     <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>联系电话：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="phone" name="PHONE" datatype="*2-5" nullmsg="电话不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
     <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>邮箱：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="email" name="EMAIL" datatype="*2-5" nullmsg="邮箱不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
     <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>地址：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="address" name="ADDRESS" datatype="*2-5" nullmsg="地址不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
     <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>邮政编码：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="postcode" name="POSTCODE" datatype="*2-5" nullmsg="邮政编码不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
  	
  	<div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>人员介绍：</label>
      <div class="formControls col-5">
      <!-- 初始化编辑器 -->
        <script id="editor" type="text/plain" style="width:800px;height:300px;" name="DESCRIPTION"></script>
      </div>
      <div class="col-4"> </div>
    </div>
   
   <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>人员照片：</label>
      <div class="formControls col-5">
      <input type="file" name="file" />  
      </div>
      <div class="col-4"> </div>
    </div>
   
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
      	 <a class="btn btn-danger" href="con/list.do">取消</a>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="static/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="static/admin/lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="static/admin/lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="static/admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="static/admin/js/H-ui.js"></script> 
<script type="text/javascript" src="static/admin/js/H-ui.admin.js"></script>
<script type="text/javascript">
function validate(){
        var title = document.getElementById("title");
        var username = document.getElementById("username");
        var phone = document.getElementById("phone");
        var email = document.getElementById("email");
        var address = document.getElementById("address");
        var postcode = document.getElementById("postcode");
        if(trim(title.value)==null || trim(title.value)==""){
            alert("请输入职称！");
            title.focus();
            return false;
        }
        if(trim(username.value)==null || trim(username.value)==""){
            alert("请输入姓名！");
            username.focus();
            return false;
        }
         if(trim(phone.value)==null || trim(phone.value)==""){
            alert("请输入联系方式！");
            phone.focus();
            return false;
        }
        
       	if(trim(email.value)==null || trim(email.value)==""){
            alert("请输入邮箱！");
            email.focus();
            return false;
        }
        if(trim(email.value)!=null || trim(email.value)!=""){
        	checkEmail();
        	return true;
        }
        if(trim(address.value)==null || trim(address.value)==""){
            alert("请输入地址！");
            address.focus();
            return false;
        }
       if(trim(postcode.value)==null || trim(postcode.value)==""){
            alert("请输入邮政编码！");
            postcode.focus();
            return false;
        }
        return true;
    }
    function trim(str){ //删除左右两端的空格
     return str.replace(/(^\s*)|(\s*$)/g, "");
    }
</script>
<script type="text/javascript">
function checkEmail(){  
        var email = $("#email").val();  
        email = $.trim(email);  
        var pattern = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;  
        if(email != null && email != ""){     
            if(!pattern.test(email)){  
                    $("#span2").html("<font color='red'>邮箱不合法，请重新输入！</font>");  
                    $("#email").focus();  
                    return false;  
            }  
        }else{  
            $("#span2").html("<font color='red'>邮箱不能为空！</font>");  
            $("#email").val("");  
            $("#email").focus();  
            return false;  
        }  
        $("#span2").html("<font color='green'>邮箱可用！</font>");  
    }  

</script>
<script type="text/javascript">
		
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');
    function isFocus(e){
        alert(UE.getEditor('editor').isFocus());
        UE.dom.domUtils.preventDefault(e)
    }
    function setblur(e){
        UE.getEditor('editor').blur();
        UE.dom.domUtils.preventDefault(e)
    }
    function insertHtml() {
        var value = prompt('插入html代码', '');
        UE.getEditor('editor').execCommand('insertHtml', value)
    }
    function createEditor() {
        enableBtn();
        UE.getEditor('editor');
    }
    function getAllHtml() {
        alert(UE.getEditor('editor').getAllHtml())
    }
    
 </script>
</body>
</html>